<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="UTF-8">
    <title>添加角色</title>
    
	<meta name="pragma" content="no-cache">
	<meta name="cache-control" content="no-cache">
	<meta name="content-type" content="text/html;charset=UTF-8">
	<meta name="expires" content="0">    

	  <div th:replace="~{commons/script::script}"></div>
	
  </head>
  
  <body style="width:100%;max-width:600px;padding:30px 60px;">
	<section class="info-section">
		<form id="form" method="post">
			<table>
				<tr>
					<td class="text-title">角色名称：</td>
					<td class="text-content">
						<input type="hidden" name="id" th:value="${role.id}">
						<input type="text" name="rolename" th:value="${role.rolename}"
							class="easyui-textbox theme-textbox-radius" data-options="required:true,validType:'length[3,10]'">
					</td>
				</tr>
				<tr>
					<td class="text-title">排序编号：</td>
					<td class="text-content">
						<input type="text" name="sortnum" th:value="${role.sortnum}"
							class="easyui-textbox theme-textbox-radius" data-options="required:true">
					</td>
				</tr>
				<tr>
					<td class="text-title">角色状态：</td>
					<td class="text-content">
						<select name="status" class="easyui-combobox theme-textbox-radius">
							<option value="1"  th:selected="${role.status==1?true:false}">正常</option>
							<option value="0"  th:selected="${role.status==2?true:false}">禁用</option>
							<option value="2"  th:selected="${role.status==3?true:false}">已删除</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="text-title">描述信息：</td>
					<td class="text-content">
						<textarea class="theme-textbox-radius" rows="5"  cols="20" th:text="${role.rolenote}" name="rolenote"></textarea></td>
				</tr>

				<tr style="display: none;">
					<td colspan="2">
<!--						<input type="hidden" name="roleVO.funcIds" value="${roleVO.funcIds}">-->
						<input type="hidden" name="createby" th:value="${role.createby}">
						<input type="hidden" name="updateby" th:value="${role.updateby}">
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center;margin-top: 10px;">
						<a href="javascript:void(0);" id="saveBtn" class="easyui-linkbutton button-primary">保存</a> 
						<a href="javascript:void(0);" id="resetBtn" class="easyui-linkbutton button-danger">重置</a>
					</td>
				</tr>
				</table>
		</form>
	</section>
	<script type="text/javascript">
		$(function() {
			//重置按钮
			$("#resetBtn").on("click",function(event){
				$("#form").form("reset");
			});
			
			//为保存按钮添加事件
			$("#saveBtn").on("click",function(event){
				$("#form").form("submit",{
					url:"/system/updateRole",
					onSumbit : function(){
						//调用easyui中form对象的validate方法对表单中数据进行校验，该方法返回boolean值，如果为false会阻止表单提交
						return $("#form").form("validate");
					},
					success : function(data){
						var obj = eval("("+data+")");
						if(obj.success){
							$.messager.alert("提示",obj.message);
							parent.closeTopWindow();
						}else{
							$.messager.alert("警告",obj.message);
						}
					}
				});
			});
			
		});
			
	</script>
</body>
</html>
				
